using System;
using System.Collections.Generic;
using System.Text;
using Xyne.Actions;

namespace Xyne.Utilities
{
    public class ActionManager
    {
        // Action state changed delegate
        public delegate void ActionStateChangedDelegate(Action a);
        // Instance
        private static ActionManager instance = new ActionManager();
        // List of callbacks
        private List<ActionStateChangedDelegate> callbacks = new List<ActionStateChangedDelegate>();

        public static ActionManager Instance
        {
            get { return instance; }
        }

        public List<ActionStateChangedDelegate> Callbacks
        {
            get { return callbacks; }
        }

        private ActionManager()
        {
        }

        public void ActionActivated(Action a)
        {
            foreach (ActionStateChangedDelegate callback in callbacks)
            {
                if (callback != null)
                {
                    callback(a);
                }
            }
        }
    }
}
